package com.lagou.server.service.dto;

import com.alibaba.fastjson.JSON;
import java.io.IOException;

/**
 * JSON序列化类
 * @author yzh
 */
public class JSONSerializer implements Serializer{

    @Override
    public byte[] serialize(Object object) throws IOException {
        return JSON.toJSONBytes(object);
    }

    @Override
    public <T> T deserialize(Class<T> clazz, byte[] bytes) throws IOException {
        return JSON.parseObject(bytes, clazz);
    }

}